package com.boot.security.server.dao.product;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.product.TswDistributionGoods;

@Mapper
public interface TswDistributionGoodsDao {

    @Select("select * from tsw_distribution_goods t where t.id = #{id}")
    TswDistributionGoods getById(Long id);

    @Delete("delete from tsw_distribution_goods where id = #{id}")
    int delete(Long id);

    int update(TswDistributionGoods tswDistributionGoods);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_distribution_goods(product_id, specifications_id, mall_type, receive_number, operation_time, tsw_sys_user_id, receive_note, receive_remark) values(#{productId}, #{specificationsId}, #{mallType}, #{receiveNumber}, #{operationTime}, #{sysUserId}, #{receiveNote}, #{receiveRemark})")
    int save(TswDistributionGoods tswDistributionGoods);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswDistributionGoods> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
